<template>
  <el-dialog
    :visible.sync="visible"
    :before-close="beforeClose"
    :close-on-click-modal="false"
    append-to-body
    class="dialog-sm"
    top="30px"
    width="1000px"
  >
    <el-tabs v-model="active">
      <el-tab-pane label="未签章" name="noSign">
        <sign-tool ref="noSign" status="0,1" @success="getTabData"></sign-tool>
      </el-tab-pane>
      <el-tab-pane label="已签章" name="yesSign">
        <sign-tool ref="signPass" @success="getTabData" :routeId="docId" status="2,3"></sign-tool>
      </el-tab-pane>
    </el-tabs>
  </el-dialog>
</template>

<script>
import SignTool from '@/credit/views/county/index/tools/SignTool'
export default {
  components: {
    SignTool,
  },
  props: {
    visible: Boolean,
    type: String,
    docId: String,
  },
  data() {
    return {
      active: 'noSign',
    }
  },
  computed: {},
  watch: {
    visible() {
      if (this.visible && !this.docId) {
        this.active = 'noSign'
        this.getTabData()
      }
    },
  },
  mounted() {},
  created() {
    if (this.docId) {
      this.active = 'yesSign'
      this.getTabData()
    }
  },
  methods: {
    beforeClose() {
      this.$emit('update:visible', false)
    },
    getTabData() {
      this.$nextTick(() => {
        this.$refs.noSign.getData()
        this.$refs.signPass.getData()
      })
    },
  },
}
</script>
<style lang="scss" scoped></style>
